Use the following commands and functions to manage disk files from NoteTab. Use fully qualified file names (with path name) to ensure the commands and functions find the correct file. See also Disk Directories for related commands.
Commands:
^!AppendTextToUnicodeFile "FileName" AnyText (added in v4.82)
Appends the specified text to the end of a disk file in Unicode format using the current Windows code page. A new file is created if FileName does not exist.
^!AppendToFile "FileName" AnyText
Appends the specified text to the end of a disk file. A new file is created if FileName does not exist.
^!CloseFileFind
Optional command to close the list of files created with the GetFileFirst function. It is recommended to use this command when you have finished using the list of files as it releases system resources.
^!CopyFile "FileSpecs" "Destination"
Copies the specified file(s) (wildcards can be used) to another directory. Use double quotes around the file names if they contain spaces. If no wildcards are used and the destination file exists, it is sent to the recycle bin before being replaced by the new file.
^!DeleteFile FileSpecs
Deletes the specified file(s) (wildcards can be used) from the disk.
^!Export "FileName" [ASCII|ANSI][MAC|UNIX][SELECTION|ALL][HARDBREAKS]
or
^!Export "FileName" [EBCDIC][SELECTION|ALL][LRECL=nnn] (added in v4.6)
Exports current document under specified file name. Optional settings are used to define output format. Use a comma or colon to separate multiple settings and use double quotes around the file name if it contain spaces. When creating EBCDIC files, you can optionally define a record length (for fixed-width lines) by using the LRECL parameter followed by an equal sign and the width value.
^!IfFileAttr "FileName" Attr GoToLabelTrue [ELSE GoToLabelFalse] (added in v4.8)
Compares FileName attributes with Attr. If Attr is equal or a subset of FileName's attributes, then GoToLabelTrue is activated. Attr can represent multiple values: A = Archive, D = Directory, H = Hidden, R = Read-only, S = System, V = VolumeID, * = All attributes. Example:
^!IfFileAttr "c:\Scandisk.log" AH LabelTrue ELSE LabelFalse
If Scandisk.log has at least the Archive and Hidden attributes set, then the instruction jumps to LabelTrue.
^!FileScramble "InputName"[ "OutputName"[ "Key"]] (added in v4.84)
encrypts and decrypts files. This command can automatically detect if the file needs encrypting or decrypting. InputName is the file to encrypt or decrypt. Use the optional OutputName to define the name of the file created by the operation. If the file is going to be encrypted and you don't specify an output name, the name will be based on InputName with the extension ".npw". If the file is going to be decrypted and you don't specify an output name, the original file name will be used. Use the optional "Key" parameter to define an encryption password (max. 255 characters). Make sure you don't forget your password, or you will not be able to restore your encrypted data.
The encryption algorithm is based on RC4 ("RC4" is a trademark of RSA security corporation). You should not rely on this feature to protect very sensitive data.
^!MoveFile "FileSpecs" "Destination"
Moves the specified file(s) (wildcards can be used) to another directory. Use double quotes around the file names if they contain spaces.
^!RecycleFile FileSpecs
Moves the specified file(s) (wildcards can be used) to the recycle bin.
^!Refresh
Use this command after file management actions to update the list of available Clipbook libraries and the contents of the Quick List tool. It also checks if any of the open documents were changed on disk.
^!RenameFile "OldName" "NewName"
Renames the specified file (no wildcards allowed). Use double quotes around the file names if they contain spaces.
^!SetFileAttr "FileSpecs" Attr (added in v4.8)
Changes the file attributes. FileSpecs is the file name, which may have wild cards. Attr can represent multiple values: A = Archive, H = Hidden, R = Read-only, S = System, * = All attributes. Use a minus sign in front of the letter to remove an attribute. The following example sets the Archive attribute and removes the Read-only attribute, if set:
^!SetFileAttr "c:\Scandisk.log" A-R
^!TextToFile "FileName" AnyText
Creates a disk file containing the specified text. If a file with such a name already exists on disk, it will be replaced by the new file.
^!TextToUnicodeFile "FileName" AnyText (added in v4.82)
Saves the specified text to FileName in the Unicode format using the current Windows code page.
^!UUDecode "InputName"[ "OutputName"] (added in v4.84)
InputName is the file to decode. Use the optional OutputName to define the name of the UUEncoded data file. If you don't specify an output name, the name stored in the encoded file will be used.
^!UUEncode "InputName"[ "OutputName"] (added in v4.84)
InputName is the file to encode. Use the optional OutputName to define the name of the UUEncoded data file. If you don't specify an output name, the name will be based on InputName with the extension ".uue".
Functions:
^$ChangeFileExt("FileName";"Ext")$ (added in v4.84)
Use this function to create a new file name based on the provided extension. Example:
^$ChangeFileExt("c:\config.sys";"bak")$ = c:\config.bak
^$FileToUrl("FileName")$ (added in v4.8)
Converts a Windows file name to a URL file name. Example:
^$FileToUrl("c:\program files\index.htm")$ -> file:///c|/program%20files/index.htm
^$GetCrcFile("Filename")$ (added in v4.84)
Returns the CRC32 (cyclic redundancy check) value of the specified file. Example:
^$GetCrcFile("^$GetAppFileName$")$
^$GetExpandedName(FileName;BaseDir)$ (added in v4.8)
Returns the fully qualified name of FileName against BaseDir. If BaseDir is not defined, the active document path is used as the reference directory. Example:
^$GetExpandedName(..\MyFile.txt;c:\temp\test\)$ -> c:\temp\MyFile.txt
^$GetExt(FileName)$
Returns the extension of FileName (with extension dot).
^$GetFileAttr(FileName)$ (added in v4.8)
Returns the file attributes as a string of characters. A file can have zero, one, or several attributes. The string may contain the following characters: A = Archive, D = Directory, H = Hidden, R = Read-only, S = System, V = VolumeID, * = All attributes. Example:
^$GetFileAttr(c:\Scandisk.log)$ -> AH
^$GetFileDate(FileName)$
Returns the file date as yyyymmdd. Returns 0 if file does not exist.
^$GetFileFirst(FilePath;FileSpecs[;SortingOrder])$
^$GetFileFirst(FilePath;FileSpecs[;Attr][;SortingOrder])$ (added in v4.8)
^$GetFileFirst([+]FilePath;FileSpecs[;Attr][;SortingOrder])$ (added in v4.83)
Returns the first file name in the list generated by the function. FilePath indicates the directory you want to search and FileSpecs the specs to match the files. FileSpecs can contain the standard wildcards * and ?, and you can specify several criteria separated by a semicolon (;). You must use double-quotes around the FileSpecs parameter if you specify several criteria. The third parameter, SortingOrder, is optional and can be used to specify a sorting order that is different from the default which is file names sorted in alphabetical order. You can use the following values for SortingOrder:
UNSORTED: No sorting is used.
NAME: Files are sorted by name.
TYPE: Files are sorted by type (based on the extension).
DATE: Files are sorted by date.
SIZE: Files are sorted by size.
Use the prefix "REV" to reverse the sorting order (e.g. REVSIZE starts with the largest file).
Version 4.8: added optional Attr parameter. Attr can represent multiple values: A = Archive, H = Hidden, R = Read-only, S = System, * = All attributes. If the Attr parameter is not used, then file attributes are ignored.
Version 4.83: When the Attr field is used, only files that use the specified attributes are selected. To select files that have no attribute settings, use "-" as a value for Attr. You can also span through subdirectories by adding a + sign in front of the FilePath criteria.
^$GetFileName(FileName)$
Returns the name and extension of FileName (without path). Since version 4.8, this function works both on Windows file names and URLs.
^$GetFileNext$
Returns the next file name in the list. If there are no more files, then the result is an empty string.
^$GetFiles(FilePath;FileSpecs[;Attr][;SortingOrder])$ (added in v4.8)
^$GetFiles([+]FilePath;FileSpecs[;Attr][;SortingOrder])$ (added in v4.83)
The parameters are identical to the ^$GetFileFirst$ function. Returns all matching files as a single string using a blank space separator, or the one defined by ^!SetListDelimiter. Note that ^$GetFileNext$ and ^!CloseFileFind do not work with this function. This new function is useful to assign the result to an array variable. Example:
^!SetArray %Files%=^$GetFiles("c:\Program Files\NoteTab Pro\Documents";*.txt;AR;DATE)$
Version 4.83: When the Attr field is used, only files that use the specified attributes are selected. To select files that have no attribute settings, use "-" as a value for Attr. You can also span through subdirectories by adding a + sign in front of the FilePath criteria. The following example will select all files under Windows and its subdirectories, that have the System attribute set:
^$GetFiles("+C:\Windows";*.*;S;Name)$
^$GetFileSize(FileName)$
Returns the size of FileName.
^$GetFileText(FileName)$
Returns the content of the specified file. The value is an empty string if the file does not exist.
^$GetFileTime(FileName)$
Returns the file time as hhnnss. The value is 0 if file does not exist.
^$GetImgHeight(FileName)$
Returns the height in pixels of the specified image file (.gif, .png, .jpg, .bmp). The value is 0 if file does not exist or is not an image.
^$GetImgWidth(FileName)$
Returns the width in pixels of the specified image file (.gif, .png, .jpg, .bmp). The value is 0 if file does not exist or is not an image.
^$GetMD5File("Filename")$ (added in v4.84)
Returns the MD5 signature of the specified file. The result is produced in hexadecimal format. MD5 is a hashing algorithm that generates a digital signature, or Message Digest, representing the supplied data. The MD5 algorithm was produced by RSA Data Security Inc. Example:
^$GetMD5File("^$GetAppFileName$")$
^$GetName(FileName)$
Returns the name of FileName (without path or file extension). Since version 4.8, this function works both on Windows file names and URLs.
^$GetPath(FileName)$
Returns the path segment of FileName (always ends with backslash). Since version 4.8, this function works both on Windows file names and URLs.
^$GetRelativeName(FileName;BaseDir)$ (added in v4.8)
Returns the relative name of FileName against BaseDir. FileName must include a fully qualified path. Enclose the parameters in quotes if they contain a semicolon in the name. If BaseDir is not defined, the active document path is used as the reference directory. Example:
^$GetRelativeName(c:\temp\test\MyFile.txt;c:\temp\)$ -> test\MyFile.txt
^$GetShort(FileName)$
Returns the DOS short name of FileName.
^$GetTempFile$
Returns a Windows temporary filename which can then be used to store data. This file is automatically deleted when you exit Windows.
^$GetUnicodeFileText("FileName")$ (added in v4.82)
Reads Unicode text from FileName and returns it as normal text based on the current Windows code page.
^$UrlToFile("URL")$ (added in v4.8)
Converts a URL file name to a Windows file name. Example:
^$UrlToFile("file:///c|/program%20files/index.htm")$ -> c:\program files\index.htm